/*
 * @Description: 分享
 * @Author: iamsmiling
 * @Date: 2021-05-30 23:06:22
 * @LastEditTime: 2021-06-11 10:31:53
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ShareChannelEntity {
  late String icon;
  late String label;

  ShareChannelEntity({required this.icon, required this.label});
}

Future showSharePicker(BuildContext context) {
  List<ShareChannelEntity> options = [
    ShareChannelEntity(icon: R.image.wechatShare, label: "微信"),
    ShareChannelEntity(icon: R.image.wechatMomentShare, label: "朋友圈"),
    ShareChannelEntity(icon: R.image.qqShare, label: "QQ"),
    ShareChannelEntity(icon: R.image.linkShare, label: "复制链接"),
  ];

  return showCupertinoModalPopup(
      context: context,
      builder: (BuildContext context) {
        return Material(
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(10),
            topRight: Radius.circular(10),
          ),
          child: Container(
            // height: R.dimen.height * 198 / 675,
            child: Column(
              mainAxisSize: MainAxisSize.min,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  padding:
                      EdgeInsets.only(top: R.dimen.dp50, bottom: R.dimen.dp32),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: [
                      for (ShareChannelEntity item in options)
                        Column(
                          children: [
                            Image.asset(item.icon),
                            Container(
                              margin: EdgeInsets.only(top: R.dimen.dp5),
                              child: Text(
                                item.label,
                                style: TextStyle(
                                    color: R.color.ff666666,
                                    fontSize: R.dimen.sp12),
                              ),
                            )
                          ],
                        )
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(
                      left: R.dimen.dp18,
                      right: R.dimen.dp18,
                      bottom: R.dimen.dp18),
                  child: ElevatedButton(
                    onPressed: () {},
                    child: Text("取消"),
                    style: ButtonStyle(
                      shape: MaterialStateProperty.all(RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(R.dimen.sp20))),
                      backgroundColor:
                          MaterialStateProperty.all(R.color.ff00c28a),
                    ),
                  ),
                ),
              ],
            ),
          ),
        );
      });
}
